package za.ac.sun.cs.viz.distrib;

import java.util.HashSet;
import java.util.Set;

public class VizTreeRoot extends VizTreeNode {

	private static VizNode inactiveRootTIB = new VizNode("true", VizTreePane.INACTIVE, VizTreePane.NOONE);

	private static VizNode activeRootTIB = new VizNode("true", VizTreePane.CHANGE, VizTreePane.NOONE);
	
	private final Set<Long> timestamps = new HashSet<Long>();

	public VizTreeRoot() {
		super("root");
	}

	@Override
	public void addValue(long timestamp, int id, long value, int activity) {
		throw new RuntimeException("THIS SHOULDN'T HAPPEN");
	}

	@Override
	public long getValue(long timestamp) {
		return 1;
	}

	@Override
	public VizNode getVizNode(long timestamp) {
		if (timestamps.contains(timestamp)) {
			return activeRootTIB;
		} else {
			return inactiveRootTIB;
		}
	}

	public void addValue(long timestamp) {
		timestamps.add(timestamp);
	}
	
}
